From: kfraser@localhost.localdomain Date: Tue, 1 Aug 2006 10:54:45 +0000 (+0100) Subject: [NET] Enable TCPv4 segmentation offload in front/back drivers. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15754^2~30 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0434f44fcd71e71ab93df1a90109357d5d6c6e65;p=xen.git [NET] Enable TCPv4 segmentation offload in front/back drivers. Signed-off-by: Keir Fraser --- diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c index 82832368b9..4de5a9cb0b 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c @@ -221,13 +221,20 @@ static struct sk_buff *netbk_copy_skb(struct sk_buff *skb) return NULL; } +static inline int netbk_max_required_rx_slots(netif_t *netif) +{ + if (netif->features & (NETIF_F_SG|NETIF_F_TSO)) + return MAX_SKB_FRAGS + 2; /* header + extra_info + frags */ + return 1; /* all in one */ +} + static inline int netbk_queue_full(netif_t *netif) { - RING_IDX peek = netif->rx_req_cons_peek; + RING_IDX peek = netif->rx_req_cons_peek; + RING_IDX needed = netbk_max_required_rx_slots(netif); - return ((netif->rx.sring->req_prod - peek) <= (MAX_SKB_FRAGS + 1)) || - ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) <= - (MAX_SKB_FRAGS + 1)); + return ((netif->rx.sring->req_prod - peek) < needed) || + ((netif->rx.rsp_prod_pvt + NET_RX_RING_SIZE - peek) < needed); } int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) @@ -271,7 +278,7 @@ int netif_be_start_xmit(struct sk_buff *skb, struct net_device *dev) if (netbk_can_queue(dev) && netbk_queue_full(netif)) { netif->rx.sring->req_event = netif->rx_req_cons_peek + - MAX_SKB_FRAGS + 2; + netbk_max_required_rx_slots(netif); mb(); /* request notification /then/ check & stop the queue */ if (netbk_queue_full(netif)) netif_stop_queue(dev); diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c index eb51533942..0d34bc8511 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c @@ -101,14 +101,12 @@ static int netback_probe(struct xenbus_device *dev, goto abort_transaction; } -#if 0 /* KAF: After the protocol is finalised. */ err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1); if (err) { message = "writing feature-gso-tcpv4"; goto abort_transaction; } -#endif err = xenbus_transaction_end(xbt, 0); } while (err == -EAGAIN); @@ -384,7 +382,6 @@ static int connect_rings(struct backend_info *be) be->netif->dev->features |= NETIF_F_SG; } -#if 0 /* KAF: After the protocol is finalised. */ if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-gso-tcpv4", "%d", &val) < 0) val = 0; @@ -392,7 +389,6 @@ static int connect_rings(struct backend_info *be) be->netif->features |= NETIF_F_TSO; be->netif->dev->features |= NETIF_F_TSO; } -#endif /* Map the shared frame, irq etc. */ err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn); diff --git a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c index 9ab89571de..3be2e87a7c 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c @@ -338,13 +338,11 @@ again: goto abort_transaction; } -#if 0 /* KAF: After the protocol is finalised. */ err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1); if (err) { message = "writing feature-gso-tcpv4"; goto abort_transaction; } -#endif err = xenbus_transaction_end(xbt, 0); if (err) { @@ -1327,9 +1325,7 @@ static int xennet_set_tso(struct net_device *dev, u32 data) if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-gso-tcpv4", "%d", &val) < 0) val = 0; -#if 0 /* KAF: After the protocol is finalised. */ if (!val) -#endif return -ENOSYS; }